/**
 * @controller 工时管理
 * @description 工时管理
 * @version: 0.0.1
 * @author: ljr
 * @Date: 2023-09-12 16:35:58
 */

import { Inject, Controller, Body, Post, Get, Query } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { WorkingService } from '../service/working.service';
import { WorkingDepartService } from '../service/working.depart.service';
import { CreatedWorkingDTO, UpdateWorkingDTO, SetWorkAmountDTO } from '../dto/working';
import { IdDTO, PageDTO } from "../dto/common"

@Controller('/api/v1/working')
export class workController {
  @Inject()
  ctx: Context;
  @Inject()
  WorkingService: WorkingService;
  @Inject()
  WorkingDepartService: WorkingDepartService;
  /**
   * @summary 创建工时登记信息
   * @description 创建工时登记信息
   * @router post /api/v1/working/createdWorking
   * @request body access_token  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/createdWorking')
  async createdWorking(@Body() options: CreatedWorkingDTO): Promise<any> {
    return await this.WorkingService.createdWorking(options);
  }


  /**
   * @summary 项目列表分页查询
   * @description 项目列表分页查询
   * @router post /api/v1/working/getWorkingPage
   * @request body pageNum  *body
   * @request body pageSize  *body
   * @request body searchKey  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/getWorkingPage')
  async getWorkingPage(@Body() options: PageDTO): Promise<any> {
    return await this.WorkingService.getWorkingPage(options);
  }

  /**
   * @summary 更新工时登记信息
   * @description 更新工时登记信息
   * @router post /api/v1/working/updateWorking
   * @request body pageNum  *body
   * @request body pageSize  *body
   * @request body searchKey  *body
   * @response 200 baseResponse 返回结果
   */
  @Post('/updateWorking')
  async updateWorking(@Body() options: UpdateWorkingDTO): Promise<any> {
    return await this.WorkingService.updateWorking(options);
  }

  /**
   * @summary 删除工时信息
   * @description 删除工时信息
   * @router post /api/v1/working/delWorking
   * @request body id  *body
   * @response 200 baseResponse 返回结果
   */
  @Get('/delWorking')
  async delWorking(@Query() options: IdDTO): Promise<any> {
    return await this.WorkingService.delWorking(options);
  }


  /**
    * @summary 更新工时登记信息
    * @description 更新工时登记信息
    * @router post /api/v1/working/setWorkAmount
    * @request body pageNum  *body
    * @request body pageSize  *body
    * @request body searchKey  *body
    * @response 200 baseResponse 返回结果
    */
  @Post('/setWorkAmount')
  async setWorkAmount(@Body() options: SetWorkAmountDTO): Promise<any> {
    return await this.WorkingService.setWorkAmount(options);
  }
}